package com.liyunc.demo.bundle.security.config;


import com.fasterxml.jackson.databind.ObjectMapper;
import com.liyunc.demo.comp.jwt.JwtCodec;
import com.liyunc.demo.comp.jwt.impl.JwtCodecImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liyuncong
 * @version 1.0
 * @file JwtConfiguration.java
 * @brief JwtConfiguration
 * @details JwtConfiguration
 * @date 2022-03-28
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2022-03-28               liyuncong        Created
 */
@Configuration
public class JwtConfiguration {

    @ConditionalOnMissingBean(JwtCodec.class)
    @Bean
    public JwtCodec<Object> jwtCodec(ObjectMapper objectMapper) {
        return new JwtCodecImpl<>(objectMapper);
    }
}
